package com.yjhb.android.sbz.dialog;

import android.app.Activity;
import android.content.DialogInterface;
import android.view.View;
import android.widget.TextView;

import com.yjhb.android.sbz.R;
import com.yjhb.android.sbz.tool.DataSaveTool;
import com.yjhb.android.sbz.tool.Tool;
import com.jojo.android.zxlib.base.BaseDialog;
import com.jojo.android.zxlib.view.checkbox.SmoothCheckBox;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 创建者 zx
 * 创建时间 2021/2/5 9:09
 */
public class TaskTipsDialog extends BaseDialog implements DialogInterface.OnDismissListener {
    private final String TAG = "TaskTipsDialog";
    @BindView(R.id.checkbox)
    SmoothCheckBox checkbox;
    @BindView(R.id.button1)
    TextView button1;
    @BindView(R.id.button2)
    TextView button2;

    public TaskTipsDialog(Activity context) {
        super(context);
    }

    @Override
    protected void init() {
        setOnDismissListener(this);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_task_tips;
    }

    @OnClick({R.id.button1, R.id.button2})
    void onClick(View view) {
        if (view == button1) {
            Tool.startWebActivity(getContext(),"http://www.shangbangzuan.com:81/user_need_know.html","新人须知");
        } else if (view == button2) {
            dismiss();
        }
    }

    @Override
    public void onDismiss(DialogInterface dialog) {
        DataSaveTool.saveShowTaskTips(!checkbox.isChecked());
    }
}
